import request from '@/utils/request'

/** ===================================系统字典-业务模块=================================== */

/**
 * 根据id查询系统用户
 * @author 童年的纸飞机
 * @since 2023-06-07 13:37
 * @param id
 * @returns {*}
 */
const findSysUserById = (id) => {
  return request({
    url: '/api/SysUser/findSysUserById',
    method: 'GET',
    params: { id: id }
  })
}

/**
 * 新建系统用户
 * @author 童年的纸飞机
 * @since 2023-06-07 13:37
 * @param model
 * @returns {*}
 */
const createSysUser = (model) => {
  return request({
    url: '/api/SysUser/createSysUser',
    method: 'POST',
    data: model
  })
}

/**
 * 更新系统用户
 * @author 童年的纸飞机
 * @since 2023-06-07 13:37
 * @param model
 * @returns {*}
 */
const updateSysUser = (model) => {
  return request({
    url: '/api/SysUser/updateSysUser',
    method: 'PUT',
    data: model
  })
}

/**
 * 根据ID删除系统用户
 * @author 童年的纸飞机
 * @since 2023-06-07 13:37
 * @param id
 * @returns {*}
 */
const removeSysUserById = (id) => {
  return request({
    url: '/api/SysUser/removeSysUserById',
    method: 'DELETE',
    params: { id: id }
  })
}

/**
 * 分页查询系统用户
 * @author 童年的纸飞机
 * @since 2023-06-07 13:37
 * @param params
 * @returns {*}
 */
const querySysUserPage = (params) => {
  return request({
    url: '/api/SysUser/querySysUserPage',
    method: 'GET',
    params: params
  })
}

/**
 * 查询系统用户列表
 * @author 童年的纸飞机
 * @since 2023-06-07 13:37
 * @param params
 * @returns {*}
 */
const querySysUserList = (params) => {
  return request({
    url: '/api/SysUser/querySysUserList',
    method: 'GET',
    params: params
  })
}

/**
 * 导出系统用户
 * @author 童年的纸飞机
 * @since 2023-06-07 13:37
 * @param params
 * @returns {*}
 */
const exportSysUserExcel = (params) => {
  return request({
    url: '/api/SysUser/exportSysUserExcel',
    method: 'GET',
    params: params,
    responseType: 'blob'
  })
}

/**
 * 批量编辑系统用户
 * @author 童年的纸飞机
 * @since 2023-06-07 13:37
 * @param modelList
 * @returns {*}
 */
const updateSysUserByList = (modelList) => {
  return request({
    url: '/api/SysUser/updateSysUserByList',
    method: 'PUT',
    data: modelList
  })
}

/**
 * 批量删除系统字典
 * @author 童年的纸飞机
 * @since 2023-06-07 13:37
 * @param ids
 * @returns {*}
 */
const removeSysUserByIds = (ids) => {
  return request({
    url: '/api/SysUser/removeSysUserByIds',
    method: 'DELETE',
    data: ids
  })
}

export default {
  findSysUserById,
  createSysUser,
  updateSysUser,
  removeSysUserById,
  querySysUserPage,
  querySysUserList,
  exportSysUserExcel,
  updateSysUserByList,
  removeSysUserByIds
}
